package com.qf.course.web.controller;

import com.qf.course.core.entity.User;
import com.qf.course.core.service.UserService;
import com.qf.course.core.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * description:
 * author: Ken
 * 公众号：Java架构栈
 */
@RestController
@RequestMapping("/tea")
@CrossOrigin(origins = "http://10.36.135.10:8848", allowCredentials = "true")
public class TeacherController {

    @Autowired
    private UserService userService;

    /**
     * 查询所有老师信息
     * @return
     */
    @RequestMapping("/list")
    public R list(){
        List<User> teachers = userService.queryByRole(1);
        return R.create(teachers);
    }
}
